//
//  LLSettingView.m
//  Diary
//
//  Created by lanou3g on 15/11/9.
//  Copyright © 2015年 王艺拓. All rights reserved.
//

#import "LLSettingView.h"
#import "WYTDevicesTool.h"

@implementation LLSettingView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubViews];
        self.baseImageView.image = [UIImage imageNamed:@"settingBG"];
    }
    return self;
}

#pragma mark --- 设置界面布局
- (void)addSubViews{
    self.baseImageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.baseImageView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.baseImageView];
    
    
    self.photoImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth*0.03, kScreenWidth*0.03, kScreenWidth*(1-0.03*2), kScreenWidth*(1-0.03*2))];
    self.photoImageView.image = [UIImage imageNamed:@"imgPlaceHolderEVB"];
    self.photoImageView.userInteractionEnabled = YES;
    [self addSubview:self.photoImageView];
    
    
    
    NSInteger loginOrRegisterButtonFontSize = 24;
    NSInteger labelFontSize = 20;
    if ([WYTDevicesTool iPhone6_iPhone6s]) {
        loginOrRegisterButtonFontSize = 22;
        labelFontSize = 18;
    }else if([WYTDevicesTool iPhone320_DEVICES]){
        loginOrRegisterButtonFontSize = 22;
        labelFontSize = 16;
    }
    
    
    self.loginOrRegisterButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.loginOrRegisterButton.frame = CGRectMake(CGRectGetMinX(self.photoImageView.frame), CGRectGetMaxY(self.photoImageView.frame), kScreenWidth/3, kScreenWidth/6);
    [self.loginOrRegisterButton setTitle:@"登录/注册" forState:UIControlStateNormal];
    [self.loginOrRegisterButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.loginOrRegisterButton.titleLabel.font = [UIFont boldSystemFontOfSize:loginOrRegisterButtonFontSize];
    [self addSubview:self.loginOrRegisterButton];
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.loginOrRegisterButton.frame), CGRectGetMaxY(self.loginOrRegisterButton.frame) * 0.975, CGRectGetWidth(self.photoImageView.frame)*0.8, 1)];
    lineView.backgroundColor = [UIColor colorWithRed:64/255.0 green:64/255.0 blue:64/255.0 alpha:1];
    [self addSubview:lineView];
    
    
    
    // 同步
    self.syncView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.loginOrRegisterButton.frame)*1.7, kScreenHeight/3*2, kScreenWidth*0.06, kScreenWidth*0.06)];
    self.syncView.backgroundColor = [UIColor colorWithRed:255/255.0 green:95/255.0 blue:94/255.0 alpha:1];
    [self addSubview:self.syncView];
    
    self.syncLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.syncView.frame)+CGRectGetWidth(self.syncView.frame)*0.2, CGRectGetMinY(self.syncView.frame), kScreenWidth/2, CGRectGetHeight(self.syncView.frame))];
    self.syncLabel.text = @"同步到云端";
    self.syncLabel.userInteractionEnabled = YES;
    self.syncLabel.font = [UIFont boldSystemFontOfSize:labelFontSize];
    [self addSubview:self.syncLabel];
    
    
    
    // 清除缓存
    self.cachesView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.syncView.frame), CGRectGetMaxY(self.syncView.frame)+CGRectGetHeight(self.syncView.frame), CGRectGetWidth(self.syncView.frame), CGRectGetHeight(self.syncView.frame))];
    self.cachesView.backgroundColor = [UIColor colorWithRed:255/255.0 green:192/255.0 blue:114/255.0 alpha:1];
    [self addSubview:self.cachesView];
    self.cachesLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.cachesView.frame)+CGRectGetWidth(self.cachesView.frame)*0.2, CGRectGetMinY(self.cachesView.frame), kScreenWidth/2, CGRectGetHeight(self.cachesView.frame))];
    self.cachesLabel.text = @"清除缓存";
    self.cachesLabel.userInteractionEnabled = YES;
    self.cachesLabel.font = [UIFont boldSystemFontOfSize:labelFontSize];
    [self addSubview:self.cachesLabel];
        
    
    // 反馈意见
    self.suggestView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.cachesView.frame), CGRectGetMaxY(self.cachesView.frame)+CGRectGetHeight(self.cachesView.frame), CGRectGetWidth(self.cachesView.frame), CGRectGetHeight(self.cachesView.frame))];
    self.suggestView.backgroundColor = [UIColor colorWithRed:156/255.0 green:255/255.0 blue:89/255.0 alpha:1];
    [self addSubview:self.suggestView];
    
    self.suggestLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.suggestView.frame)+CGRectGetWidth(self.suggestView.frame)*0.2, CGRectGetMinY(self.suggestView.frame), kScreenWidth/2, CGRectGetHeight(self.suggestView.frame))];
    self.suggestLabel.text = @"反馈意见";
    self.suggestLabel.userInteractionEnabled = YES;
    self.suggestLabel.font = [UIFont boldSystemFontOfSize:labelFontSize];
    [self addSubview:self.suggestLabel];
    
    
    // 关于我们
    self.mineView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.suggestView.frame), CGRectGetMaxY(self.suggestView.frame)+CGRectGetHeight(self.suggestView.frame), CGRectGetWidth(self.suggestView.frame), CGRectGetHeight(self.suggestView.frame))];
    self.mineView.backgroundColor = [UIColor colorWithRed:100/255.0 green:179/255.0 blue:223/255.0 alpha:1];
    [self addSubview:self.mineView];
    
    self.mineLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.mineView.frame)+CGRectGetWidth(self.mineView.frame)*0.2, CGRectGetMinY(self.mineView.frame), kScreenWidth/2, CGRectGetHeight(self.mineView.frame))];
    self.mineLabel.text = @"关于我们";
    self.mineLabel.userInteractionEnabled = YES;
    self.mineLabel.font = [UIFont boldSystemFontOfSize:labelFontSize];
    [self addSubview:self.mineLabel];
    
}











/*
// Only override drawRect: if you perform custom drawing./Users/lanou3g/Downloads/trash.png
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
